home *** CD-ROM | disk | FTP | other *** search
/ BCI NET 2 / BCI NET 2.iso / archives / programming / amos / srmv23.lha / Resource_Banks / Bin / SRM_v23.AMOS / SRM_v23.amosSourceCode
Encoding:
AMOS Source Code  |  1992-09-03  |  35.6 KB  |  1,277 lines

  1. ' AMOSPro Resource Bank Maker V2.3 
  2. ' Default bank number is 16. Change the "BK" variable for another bank 
  3. ' Maximum bank size is in variable "BMAX"
  4. '
  5. ' update By M&F
  6. ' (c) 1993 M&F Software Corp.  
  7. '  ï¿½ 1994 9 November h17.00
  8. '  
  9. ' original vesion by Fran�ois Lionet   
  10. ' (c)1992 Europress Software Ltd.
  11. '
  12. ' Due to a bug in the Screen width function the picture width must be  
  13. ' multiple of 16. Otherwise the far right and bottom  of the image 
  14. ' cannot be used.  
  15. '
  16. '
  17. Set Buffer 32
  18. VER$="2.3"
  19. Global DB$,VER$
  20. Global YDI,QUIT,SCRN,XS,YS,SA,MOVE
  21. Global BNAME$
  22. Global PUMX,NPU,CPU,PNAME$,PULAST,PUPICS
  23. Global STMX,NST
  24. Global MX,MY,MK,MZ,MS,SW1,SH1,SW2,SH2
  25. Global BXOLD,BXINK,FL
  26. Global BXX,BXY,BXSX,BXSY
  27. Global BKPOS,BKCHANGE,BK,TBNK,BKCHUNKS,BGRB,BMAX
  28. ' Maximum number of graphic elements 
  29. PUMX=512
  30. Dim PUX(PUMX),PUY(PUMX),PUSX(PUMX),PUSY(PUMX),PU$(PUMX),PUN(PUMX)
  31. Global PUX(),PUY(),PUSX(),PUSY(),PU$(),PUN()
  32. ' Maximum number of strings
  33. STMX=256
  34. Dim ST$(STMX)
  35. Global ST$()
  36. ' Default bank number
  37. BK=16
  38. ' Maximum bank size (in K) 
  39. BMAX=128
  40. ' Temporary bank 
  41. TBNK=BK+2
  42. C$=Command Line$
  43. ' Memory check 
  44. If Chip Free+Fast Free<(BMAX+32)*1024 : LOWMEM : End If 
  45. ' Initialisation 
  46. Erase All 
  47. 'Area slider 
  48. SA=20
  49. INIT_SCREEN
  50. BANK_NEW
  51. If C$="GRAB" : MN_GRAB : End If 
  52. MN_MAIN[C$]
  53. ' Main Menu
  54. Procedure MN_MAIN[C$]
  55.    Do 
  56.       If BGRB
  57.          A$="-GRABBED- "
  58.       Else 
  59.          A$=""
  60.       End If 
  61.       If BNAME$=""
  62.          Vdialog$(1,0)=A$+"Unnamed"
  63.       Else 
  64.          Vdialog$(1,0)=A$+Right$(BNAME$,24-Len(A$))
  65.       End If 
  66.       D=Dialog Run(1,1)
  67.       If C$="DEFAULT_RESOURCE"
  68.          MN_AUTOMATIC[Resource$(0)+"AMOSPro.Default_Resource"]
  69.       End If 
  70.       If C$="EDITOR_RESOURCE"
  71.          MN_AUTOMATIC[Resource$(0)+"AMOSPro.Editor_Resource"]
  72.       End If 
  73.       If C$="MONITOR_RESOURCE"
  74.          MN_AUTOMATIC[Resource$(0)+"AMOSPro.Monitor_Resource"]
  75.       End If 
  76.       Repeat 
  77.          Multi Wait 
  78.          D=Dialog(1)
  79.          On D Proc MN_QUIT,MN_QUIT,MN_NEW,MN_LOAD,MN_SAVE,MN_SAVEAS,MN_GRAPHIC,MN_STRING,MN_GRAB,MN_ABOUT
  80.          OLDD=D
  81.       Until QUIT
  82.       QUIT=0
  83.    Loop 
  84. End Proc
  85. Procedure MN_QUIT
  86.    ' Quit the program 
  87.    D=2
  88.    If BKCHANGE
  89.       D=Dialog Box(DB$,1,"Quit resource bank maker. Sure?")
  90.    End If 
  91.    If D=2
  92.       If BGRB
  93.          D=Dialog Box(DB$,1,"Copy resource bank to previous program?")
  94.          If D=2
  95.             BNK_CREATE
  96.             If Param>=0
  97.                Bsend BK
  98.             Else 
  99.                D=Dialog Box(DB$,2,"Out of memory, cannot grab bank!")
  100.                Pop Proc
  101.             End If 
  102.          Else 
  103.             D=Dialog Box(DB$,1,"Your bank will be lost if you quit. Quit anyway?")
  104.             If D<>2 : Pop Proc : End If 
  105.          End If 
  106.       End If 
  107.       Dialog Close 1
  108.       Screen Close 0 : If PNAME$<>"" : Screen Close 1 : End If 
  109.       Erase BK : Edit 
  110.       
  111.    End If 
  112.    
  113. End Proc
  114. Procedure MN_NEW
  115.    ' Create a new bank
  116.    D=2
  117.    If BKCHANGE
  118.       D=Dialog Box(DB$,1,"Create a new bank, and loose current?")
  119.    End If 
  120.    If D=2 : BANK_NEW : QUIT=-1 : End If 
  121. End Proc
  122. Procedure MN_LOAD
  123.    Dialog Freeze 
  124.    D=2
  125.    If BKCHANGE
  126.       D=Dialog Box(DB$,1,"Load a new bank, and loose current?")
  127.    End If 
  128.    If D=2
  129.       BANK_NEW : QUIT=-1
  130.       F$=Fsel$("*.Abk","","Please choose resource bank.")
  131.       If F$="" : Pop Proc : End If 
  132.       Trap Load F$,BK
  133.       If Errtrap=0
  134.          A$="" : If Length(BK) : A$=Peek$(Start(BK)-8,8) : End If 
  135.          If A$<>"Resource"
  136.             D=Dialog Box(DB$,2,"This bank is not a resource bank.")
  137.          Else 
  138.             BNK_DIGEST[Start(BK)]
  139.             If Param : BNAME$=F$ : End If 
  140.          End If 
  141.       Else 
  142.          D=Dialog Box(DB$,2,"Disc error: could not load bank.")
  143.       End If 
  144.       If BGRB : BKCHANGE=1 : End If 
  145.    End If 
  146.    Erase BK : Dialog Unfreeze : QUIT=-1
  147. End Proc
  148. Procedure BNK_DIGEST[AB]
  149.    Do 
  150.       BKCHUNKS=Deek(AB) : DD=2 : If BKCHUNKS=0 : BKCHUNKS=2 : DD=0 : End If 
  151.       ' Grab the graphic data
  152.       AG=Leek(AB+DD)
  153.       If AG
  154.          AG=AB+AG : NP=Deek(AG) : AP=AG+2+NP*4
  155.          Add AP,4+32*2 : L=Deek(AP) : PNAME$=Peek$(AP+2,L)
  156.          P=0 : CPOS=0
  157.          Repeat 
  158.             A=Leek(AG+P*4+2)
  159.             If A
  160.                AP=AG+A
  161.                PUX(CPOS)=Deek(AP+4)*8 : PUY(CPOS)=Deek(AP+6)
  162.                PUSX(CPOS)=Deek(AP+8)*8 : PUSY(CPOS)=Deek(AP+10)*Deek(AP+12)
  163.                PUN(CPOS)=1
  164.                If Deek(AP-2)=$ABCD
  165.                   T=Peek(AP-3) : K=Peek(AP-4) : PUN(CPOS)=T
  166.                   If T=3
  167.                      If K=0 : PUSX(CPOS)=PUSX(CPOS)*3 : End If 
  168.                      If K=1 : PUSY(CPOS)=PUSY(CPOS)*3 : PUN(CPOS)=-PUN(CPOS) : End If 
  169.                      Add P,2
  170.                   End If 
  171.                   If T=9 : PUSX(CPOS)=PUSX(CPOS)*3 : PUSY(CPOS)=PUSY(CPOS)*3 : Add P,8 : End If 
  172.                End If 
  173.             End If 
  174.             Inc CPOS : Inc P
  175.          Until P>=NP
  176.       End If 
  177.       ' Grab the strings 
  178.       A=Leek(AB+4+DD)
  179.       If A
  180.          AP=AB+A : ST=0
  181.          For ST=0 To STMX
  182.             L=Peek(AP+1) : Exit If L=$FF
  183.             ST$(ST)=Peek$(AP+2,L)
  184.             AP=AP+2+L
  185.          Next 
  186.       End If 
  187.       ' Keep the other data zones in safe places 
  188.       If BKCHUNKS>2
  189.          For B=2 To BKCHUNKS-1
  190.             A=Leek(AB+DD+B*4)
  191.             If A
  192.                AP=AB+A
  193.                L=Leek(AB+DD+BKCHUNKS*4+B*4)
  194.                Reserve As Work TBNK+B,L
  195.                Copy AP,AP+L To Start(TBNK+B)
  196.             End If 
  197.          Next 
  198.       End If 
  199.       ' Load the picture 
  200.       If PNAME$<>""
  201.          Repeat 
  202.             Trap Load Iff PNAME$,1
  203.             If Errtrap
  204.                PNAME$=Fsel$("*.Iff","","Can't load the default picture","Please enter correct pathname")
  205.                If PNAME$=""
  206.                   BANK_NEW
  207.                   D=Dialog Box(DB$,2,"Sorry, load aborted!")
  208.                   Exit 2
  209.                End If 
  210.             End If 
  211.          Until Errtrap=0
  212.          SW1=Screen Width : SH1=Screen Height
  213.          'Testing resolution of the image 
  214.          SC=Screen Mode
  215.          If SC=$0 : SH2=256 : SW2=320 : End If 
  216.          If SC=$4 : SH2=512 : SW2=320 : End If 
  217.          If SC=$8000 : SH2=256 : SW2=640 : End If 
  218.          If SC=$8004 : SH2=512 : SW2=640 : End If 
  219.          Screen To Back 1 : Screen 0 : SCRN=1 : XS=0 : YS=0
  220.          Screen Display 1,136,42,320,SH2
  221.       End If 
  222.       F=-1 : Exit 
  223.    Loop 
  224. End Proc[F]
  225. Procedure MN_SAVE
  226.  
  227.    Dialog Freeze 
  228.  
  229.    BNK_CREATE
  230.  
  231.    If Param>0
  232.  
  233.       If BNAME$=""
  234.          F$=Fsel$("*.Abk","","Please choose a name.","The name should finish by '.Abk'")
  235.          If F$="" : Goto _END : End If 
  236.          BNAME$=F$
  237.       End If 
  238.  
  239.       If BNAME$<>""
  240.          Trap Save BNAME$,BK
  241.          If Errtrap=0
  242.             BKCHANGE=0
  243.          Else 
  244.             D=Dialog Box(DB$,2,"Disc error: could not save bank.")
  245.          End If 
  246.       End If 
  247.  
  248.    Else If Param=0
  249.  
  250.       D=Dialog Box(DB$,2,"Nothing to save!")
  251.  
  252.    Else 
  253.  
  254.       D=Dialog Box(DB$,2,"Out of memory!")
  255.  
  256.    End If 
  257.  
  258.    _END: Erase BK : Dialog Unfreeze : QUIT=-1 : Pop Proc
  259.  
  260. End Proc
  261. Procedure BNK_CREATE
  262.  
  263.    LMAX=BMAX*1024+Length(TBNK)+Length(TBNK+1)
  264.    Reserve As Data BK,LMAX
  265.  
  266.    ' Header 
  267.    Poke$ Start(BK)-8,"Resource"
  268.    AB=Start(BK) : EB=Start(BK)+LMAX
  269.    AL=AB+2+BKCHUNKS*4 : AP=AL+BKCHUNKS*4
  270.    Doke AB,BKCHUNKS
  271.  
  272.    ' Grab the graphic part  
  273.    PU_ARRAY
  274.    If PULAST>=0
  275.       Screen Hide 0
  276.       AG=AP : Loke AB+2,AG-AB
  277.       Doke AG,PUPICS : AP=AG+2+PUPICS*4
  278.  
  279.       Screen 1
  280.       Doke AP,Screen Colour : Doke AP+2,Deek(Screen Base+72) : Add AP,4
  281.       For C=0 To 31 : Doke AP,Colour(C) : Add AP,2 : Next 
  282.       Doke AP,Len(PNAME$) : Poke$ AP+2,PNAME$
  283.       AP=AP+Len(PNAME$)+2 : AP=AP+AP mod 2
  284.  
  285.       PN=0
  286.       For P=0 To PULAST
  287.          If PUN(P)
  288.             If PUN(P)>0 : Poke AP,0 : Poke AP+1,PUN(P) : End If 
  289.             If PUN(P)<0 : Poke AP,1 : Poke AP+1,-PUN(P) : End If 
  290.             Doke AP+2,$ABCD : Add AP,4
  291.             If PUN(P)=1
  292.                X=PUX(P) : Y=PUY(P) : SX=PUSX(P) : SY=PUSY(P) : Gosub BK_GRAB
  293.             Else If PUN(P)=3
  294.                SX=PUSX(P)/3 : Y=PUY(P) : SY=PUSY(P)
  295.                For XX=0 To 2 : X=PUX(P)+XX*SX : Gosub BK_GRAB : Next 
  296.             Else If PUN(P)=-3
  297.                SY=PUSY(P)/3 : X=PUX(P) : SX=PUSX(P)
  298.                For YY=0 To 2 : Y=PUY(P)+YY*SY : Gosub BK_GRAB : Next 
  299.             Else If PUN(P)=9
  300.                SX=PUSX(P)/3 : SY=PUSY(P)/3 : N=0
  301.                For YY=0 To 2 : For XX=0 To 2
  302.                      X=PUX(P)+XX*SX : Y=PUY(P)+YY*SY : Gosub BK_GRAB
  303.                Next : Next 
  304.             End If 
  305.          End If 
  306.       Next 
  307.       Loke AL,AP-AG
  308.       Screen Show 0 : Screen 0
  309.  
  310.    End If 
  311.  
  312.    ' Grab the text part 
  313.    For S=0 To STMX
  314.       If Len(ST$(S))
  315.          SM=S : Add LS,Len(ST$(S))
  316.       End If 
  317.    Next 
  318.    If LS
  319.       AG=AP : Loke AB+2+4,AP-AB
  320.       For S=0 To SM
  321.          Poke AP,0
  322.          Poke AP+1,Len(ST$(S))
  323.          Poke$ AP+2,ST$(S)
  324.          Add AP,2+Len(ST$(S))
  325.       Next 
  326.       Poke AP,0 : Poke AP+1,$FF : Add AP,2
  327.       Add AP,AP mod 2
  328.       Loke AL+4,AP-AG
  329.    End If 
  330.  
  331.    ' Restore the data zones 
  332.    If BKCHUNKS>2
  333.       For B=2 To BKCHUNKS-1
  334.          If Length(TBNK+B)
  335.             Loke AB+2+B*4,AP-AB
  336.             Loke AL+B*4,Length(TBNK+B)
  337.             Copy Start(TBNK+B),Start(TBNK+B)+Length(TBNK+B) To AP
  338.             Add AP,Length(TBNK+B)
  339.             Add AP,AP mod 2
  340.          Else 
  341.             Loke AB+2+B*4,0 : Loke AL+B*4,0
  342.          End If 
  343.       Next 
  344.    End If 
  345.  
  346.    ' Schink to the correct size 
  347.    L=AP-Start(BK) : Bank Shrink BK To L
  348.    Screen Show 0 : Screen 0
  349.    Pop Proc[L]
  350.  
  351.    BK_GRAB:
  352.    _BOX[X,Y,X+SX,Y+SY] : Wait 2 : _BOX[0,0,0,0]
  353.    Loke AG+2+PN*4,AP-AG
  354.    Pack 1 To BK+1,X,Y,X+SX,Y+SY
  355.    If AP+Length(BK+1)>=EB : Stop : End If 
  356.    Copy Start(BK+1),Start(BK+1)+Length(BK+1) To AP
  357.    AP=AP+Length(BK+1) : AP=(AP+1) and $FFFFFFFE
  358.    Erase BK+1
  359.    Inc PN : Return 
  360.  
  361. End Proc[L]
  362. Procedure MN_SAVEAS
  363.    N$=BNAME$ : BNAME$=""
  364.    MN_SAVE
  365.    If BNAME$="" : BNAME$=N$ : End If 
  366.    QUIT=-1
  367. End Proc
  368. Procedure MN_GRAB
  369.    Dialog Freeze 
  370.    If Prg Under
  371.       D=2
  372.       If BKCHANGE
  373.          D=Dialog Box(DB$,1,"Grab a new bank, and loose current?")
  374.       End If 
  375.       If D=2
  376.          BANK_NEW : BGRB=-1
  377.          If Blength(BK)
  378.             If Peek$(Bstart(BK)-8,8)="Resource"
  379.                BNK_DIGEST[Bstart(BK)]
  380.             End If 
  381.          End If 
  382.          If BGRB=0 : D=Dialog Box(DB$,2,"No bank to grab!") : End If 
  383.       End If 
  384.    End If 
  385.    Dialog Unfreeze : QUIT=-1
  386. End Proc
  387. Procedure MN_AUTOMATIC[F$]
  388.    Trap Load F$,BK
  389.    D=Dialog Box(DB$,1,"Update of "+F$+"?")
  390.    If D=2
  391.       If Errtrap=0
  392.          BNK_DIGEST[Start(BK)]
  393.          If Param
  394.             BNAME$=F$
  395.             BNK_CREATE
  396.             If Param>0
  397.                Save BNAME$,BK
  398.             Else If Param=0
  399.                D=Dialog Box(DB$,2,"Nothing to save!")
  400.             Else 
  401.                D=Dialog Box(DB$,2,"Out of memory!")
  402.             End If 
  403.          End If 
  404.       Else 
  405.          D=Dialog Box(DB$,2,"Cannot load resource bank!")
  406.       End If 
  407.    End If 
  408.    BANK_NEW : BGRB=0 : MN_QUIT
  409. End Proc
  410. Procedure MN_ABOUT
  411.    Screen Open 3,640,190,4,Hires
  412.    Paper 2 : Pen 3 : Set Tab 2 : Clw 
  413.    Flash Off : Curs Off : Scroll Off 
  414.    Dialog Freeze 
  415.    TXT1:
  416.    Data " ","*** SUPER RESOURCE MAKER V.2.3 ***"
  417.    Data " By M&F Software Corporation ï¿½1993-1994"," "
  418.    Data "This increased version of the original program has new features"
  419.    Data "I) The new button [MOVE BLOCK] in the graphic editor allows you to move the"
  420.    Data "flashing box without having to redefine the block."
  421.    Data "It is now possible to modify the size [SIZE] and the position [TRANS] of the"
  422.    Data "flashing box without having to redefine the entire block."
  423.    Data "II) Now the program supports pictures that may be larger than the screen."
  424.    Data "In the graphic editor, if you move the pointer close to the borders, the"
  425.    Data "picture will scroll. The program will automatically recognize the size of"
  426.    Data "the picture (it may be as large as you want if you have enough chip memory)."
  427.    Data "III) The contol panel has been enlarged to make the selection of an"
  428.    Data "element easier. The scrolling of the list has been increased."
  429.    Data "The SLIDER is updated faster after any operation."
  430.    Data "IV) Automatically set the resolution of the screen to suit that of the picture."
  431.    Data "Now you can freerly use low and hires pictures but the width of the picture"
  432.    Data "must be a multiple of 16."
  433.    Data " "
  434.    Data "This version fixes some other bug of the original version."
  435.    Data "Press the right mouse button to exit",""
  436.    Home 
  437.    Restore TXT1 : 
  438.    D$="*"
  439.    While D$<>""
  440.       Read D$ : Centre D$ : Cdown 
  441.    Wend 
  442.    Repeat 
  443.    Until Mouse Key=2
  444.    Screen Close 3
  445.    Dialog Unfreeze 
  446. End Proc
  447. ' String Edition 
  448. Procedure MN_STRING
  449.    POS=0
  450.    Do 
  451.       Vdialog(1,3)=Array(ST$(0))
  452.       Vdialog(1,4)=POS
  453.       D=Dialog Run(1,2)
  454.       Do 
  455.          Multi Wait 
  456.          D=Dialog(1) : Exit If D=1,2
  457.          POS=Vdialog(1,4)
  458.          If D=6
  459.             MN_PRINT : Exit 
  460.          End If 
  461.          If D=5
  462.             A=Dialog Box(DB$,1,"Erase all strings, sure?")
  463.             If A=2 : For S=0 To STMX : ST$(S)="" : Next : Exit : End If 
  464.          End If 
  465.          If D=4
  466.             MN_EDIT[Rdialog(1,4)] : Exit 
  467.          End If 
  468.          OLDD=D
  469.       Loop 
  470.    Loop 
  471.    QUIT=1
  472. End Proc
  473. Procedure MN_EDIT[ST]
  474.    Vdialog(1,0)=ST
  475.    Vdialog$(1,1)=ST$(ST)
  476.    D=Dialog Run(1,3)
  477.    A$=Rdialog$(1,10)
  478.    If D=2 : ST$(ST)=Rdialog$(1,10) : End If 
  479.    If D=3
  480.       If ST<STMX
  481.          For S=STMX-1 To ST Step -1
  482.             ST$(S+1)=ST$(S)
  483.          Next 
  484.       End If 
  485.       ST$(ST)=Rdialog$(1,10)
  486.    End If 
  487.    If D=4
  488.       If ST<STMX
  489.          For S=ST To STMX-1
  490.             ST$(S)=ST$(S+1)
  491.          Next 
  492.       End If 
  493.       ST$(STMX)=""
  494.    End If 
  495.    Inc BKCHANGE
  496. End Proc
  497. Procedure BANK_NEW
  498.    ' Erase the current bank from memory 
  499.    BNAME$=""
  500.    For S=0 To STMX : ST$(S)="" : Next 
  501.    For P=0 To PUMX : PU$(P)="" : PUSX(P)=0 : PUSY(P)=0 : PUN(P)=0 : Next 
  502.    If PNAME$<>"" : PNAME$="" : Screen Close 1 : End If 
  503.    BKCHANGE=0 : BKCHUNKS=2 : SCRN=0
  504.    Erase TBNK : Erase TBNK+1
  505. End Proc
  506. ' Graphic Element  
  507. Procedure MN_GRAPHIC
  508.    Screen 0
  509.    If PNAME$=""
  510.       MN_GLOAD
  511.       If PNAME$="" : QUIT=-1 : Pop Proc : End If 
  512.    End If 
  513.    CPU=0
  514.    Vdialog(1,SA)=Array(PU$(0))
  515.    Vdialog(1,SA+1)=0
  516.    D=Dialog Run(1,4)
  517.    Do 
  518.       PU_ARRAY
  519.       Dialog Update 1,SA+1,,CPU,PULAST+2
  520.       Repeat 
  521.          Screen 0
  522.          Multi Wait 
  523.          ' Flash the current element  
  524.          CPU=Rdialog(1,SA+1)
  525.          If CPU>=0
  526.             If PUX(CPU)>=0
  527.                Add FL,1,0 To 10
  528.                If FL=1
  529.                   _BOX[PUX(CPU),PUY(CPU),PUX(CPU)+PUSX(CPU),PUY(CPU)+PUSY(CPU)]
  530.                End If 
  531.                If FL=5 : _BOX[0,0,0,0] : End If 
  532.             End If 
  533.          End If 
  534.          D=Dialog(1) : Exit If D=1,2
  535.          If D : _BOX[0,0,0,0] : End If 
  536.          On D-1 Proc MN_QUIT,MN_GLOAD,MN_GELEMENT,MN_GHLINE,MN_GBOX,MN_GDEL,MN_GCLEAR,MN_GVLINE,MN_MOVE1,MN_MOVE2,MN_INCX,MN_DECX,MN_INCY,MN_DECY,MN_MOVE
  537.          OLDD=D
  538.          Screen 1
  539.          MX=X Mouse : MY=Y Mouse
  540.          RR=16
  541.          If MX>440 and XS<(SW1-SW2)/RR-1 Then Inc XS
  542.          If MX<130 and XS>0 Then Dec XS
  543.          If MY>290 and YS<(SH1-SH2)/RR Then Inc YS
  544.          If MY<50 and YS>0 Then Dec YS
  545.          Screen Offset 1,RR*XS,RR*YS
  546.       Until QUIT
  547.       QUIT=0
  548.    Loop 
  549.    _BOX[0,0,0,0]
  550.    QUIT=1
  551. End Proc
  552. Procedure MN_GLOAD
  553.    F$=Fsel$("**","","Please choose an IFF picture")
  554.    If F$<>""
  555.       Trap Load Iff F$,1
  556.       If Errtrap
  557.          _ERROR
  558.          Pop Proc
  559.       End If 
  560.       Screen 1
  561.       SW1=Screen Width : SH1=Screen Height
  562.       'SW1=SW1-SW1 mod(16) 
  563.       'Testing resolution of the image 
  564.       SC=Screen Mode
  565.       If SC=$0 : SH2=256 : SW2=320 : End If 
  566.       If SC=$4 : SH2=512 : SW2=320 : End If 
  567.       If SC=$8000 : SH2=256 : SW2=640 : End If 
  568.       If SC=$8004 : SH2=512 : SW2=640 : End If 
  569.       Screen To Front 0 : Screen 0
  570.       PNAME$=F$
  571.       Inc BKCHANGE
  572.       SCRN=1 : XS=0 : YS=0
  573.       Screen Display 1,136,42,320,SH2
  574.    End If 
  575. End Proc
  576. Procedure MN_GDEL
  577.    MN_GSELECT
  578.    If Param
  579.       If CPU<=PULAST
  580.          For P=CPU To PUMX-1
  581.             PUX(P)=PUX(P+1) : PUY(P)=PUY(P+1)
  582.             PUSX(P)=PUSX(P+1) : PUSY(P)=PUSY(P+1)
  583.             PUN(P)=PUN(P+1) : PU$(P)=PU$(P+1)
  584.          Next 
  585.          PUN(PUMX)=0
  586.          Inc BKCHANGE
  587.       End If 
  588.    End If 
  589.    QUIT=-1
  590. End Proc
  591. Procedure MN_GELEMENT
  592.    MN_GGRAB[1]
  593. End Proc
  594. Procedure MN_GHLINE
  595.    MN_GGRAB[3]
  596. End Proc
  597. Procedure MN_GVLINE
  598.    MN_GGRAB[-3]
  599. End Proc
  600. Procedure MN_GBOX
  601.    MN_GGRAB[9]
  602. End Proc
  603. Procedure MN_GGRAB[T]
  604.    MN_GPIC
  605.    If Param
  606.       MN_GSELECT
  607.       If Param
  608.          Dialog Freeze 
  609.          Screen Hide 0 : _GRABIT[T]
  610.          Screen Show 0 : Screen To Front 0 : Screen 0
  611.          If Param
  612.             If CPU<PUMX
  613.                If CPU<=PULAST
  614.                   For P=PUMX To CPU+1 Step -1
  615.                      PUX(P)=PUX(P-1) : PUY(P)=PUY(P-1)
  616.                      PUSX(P)=PUSX(P-1) : PUSY(P)=PUSY(P-1)
  617.                      PUN(P)=PUN(P-1) : PU$(P)=PU$(P-1)
  618.                   Next 
  619.                End If 
  620.             End If 
  621.             PUX(CPU)=BXX : PUY(CPU)=BXY
  622.             PUSX(CPU)=BXSX : PUSY(CPU)=BXSY
  623.             PUN(CPU)=T
  624.             QUIT=-1
  625.             Inc BKCHANGE
  626.          End If 
  627.          Dialog Unfreeze 
  628.       End If 
  629.    End If 
  630. End Proc
  631. Procedure PU_ARRAY
  632.    '* Updated Slider by M&F * 
  633.    For P=0 To PUMX : PU$(P)="" : Next 
  634.    PUPICS=1 : PULAST=-1
  635.    For P=0 To PUMX
  636.       If PUN(P)
  637.          A$=Str$(PUPICS) : PU$(P)=A$+Space$(4-Len(A$))
  638.          If PUN(P)=1 : A$=" - Element:" : End If 
  639.          If PUN(P)=3 : A$=" - H. Line:" : End If 
  640.          If PUN(P)=-3 : A$=" - V. Line:" : End If 
  641.          If PUN(P)=9 : A$=" - Box    :" : End If 
  642.          PU$(P)=PU$(P)+A$+Str$(PUSX(P))+" x"+Str$(PUSY(P))
  643.          Add PUPICS,Abs(PUN(P))
  644.          PULAST=P
  645.       End If 
  646.    Next 
  647.    A$=Str$(PUPICS) : PU$(PULAST+1)=A$+Space$(4-Len(A$))+" - New Element"
  648.    Dec PUPICS
  649. End Proc
  650. Procedure MN_GCLEAR
  651.    D=2
  652.    If PULAST>=0
  653.       D=Dialog Box(DB$,1,"Clear all graphic elements, sure?")
  654.    End If 
  655.    If D=2
  656.       NPU=0
  657.       For N=0 To PUMX
  658.          PU$(N)="" : PUN(N)=0
  659.       Next 
  660.       P=-1
  661.    End If 
  662.    QUIT=-1
  663.    Inc BKCHANGE
  664. End Proc[P]
  665. Procedure MN_GSELECT
  666.    P=-1
  667.    If CPU<0
  668.       D=Dialog Box(DB$,2,"You must select an element in the list first!")
  669.       P=0
  670.    End If 
  671. End Proc[P]
  672. Procedure MN_GPIC
  673.    
  674.    P=-1
  675.    If PNAME$=""
  676.       D=Dialog Box(DB$,2,"You must load a picture first!")
  677.       P=0
  678.    End If 
  679.    
  680. End Proc[P]
  681. Procedure _GRABIT[T]
  682.    ' Prepare screen 1 
  683.    Screen 1 : Clip 
  684.    Gr Writing 2 : PDR=1 : O=0 : OMX=-1
  685.    Set Pattern 0 : Set Paint 0
  686.    _BOX[0,0,0,0]
  687.    ' Open small info screen 
  688.    Screen Open 2,640,8,2,Hires
  689.    Curs Off : Palette $55A,$FFF : Screen Display 2,,320,,
  690.    If T=1 : T$="     Grabbing a simple element" : End If 
  691.    If T=3 : T$="     Grabbing an horizontal line" : End If 
  692.    If T=-3 : T$="     Grabbing a vertical line" : End If 
  693.    If T=9 : T$="     Grabbing a box" : End If 
  694.    If T=2 : T$="     Moving an element" : End If 
  695.    ' Main loop  
  696.    Repeat 
  697.       Screen 1 : _MOUSE
  698.       MX=(MX+3) and $FFFFFFF8
  699.       If Inkey$=" " : Add BXINK,1,0 To Screen Colour : End If 
  700.       ' Change the position of the info screen 
  701.       If MY>150
  702.          Screen Display 2,,45,,
  703.       Else 
  704.          Screen Display 2,,245,,
  705.       End If 
  706.       ' Call the proper display routine  
  707.       If MS=1
  708.          If MX<>OMX or MY<>OMY or MK<>OMK
  709.             On PDR Gosub GB1,GB2,GB3
  710.             OMX=MX : OMY=MY : OMK=MK
  711.          End If 
  712.       End If 
  713.       ' Wait for the end 
  714.    Until PDR=0 or PDR=4
  715.    ' Something to erase?
  716.    _BOX[0,0,0,0]
  717.    ' Close the info screen  
  718.    Screen Close 2 : F=0
  719.    If PDR=4
  720.       BXX=X1 : BXY=Y1 : BXSX=SX : BXSY=SY
  721.       F=-1
  722.    End If 
  723.    Repeat : _MOUSE : Until MK=0
  724.    Goto _END
  725.    ' Step 1 : set the beginning of the box
  726.    GB1:
  727.    X1=MX : Y1=MY : X2=X1 : Y2=Y1
  728.    Screen 2 : Centre T$+" - X:"+Str$(X1)+" - Y:"+Str$(Y1)+"   "
  729.    If MK=1 : PDR=2 : End If 
  730.    If MK=2 : PDR=0 : End If 
  731.    Return 
  732.    ' Step 2 : open the box  
  733.    GB2:
  734.    If MX>X1 and MY>Y1
  735.       If T=1
  736.          X2=MX : Y2=MY : _BOX[X1,Y1,X2,Y2]
  737.       End If 
  738.       If T=3
  739.          If MX-X1>=24
  740.             X2=X1+((MX-X1)/24)*24 : Y2=MY
  741.             _BOX[X1,Y1,X2,Y2]
  742.          End If 
  743.       End If 
  744.       If T=-3
  745.          If MY-Y1>=3
  746.             Y2=Y1+((MY-Y1)/3)*3 : X2=MX
  747.             _BOX[X1,Y1,X2,Y2]
  748.          End If 
  749.       End If 
  750.       If T=9
  751.          If MX-X1>=24 and MY-Y1>3
  752.             X2=X1+((MX-X1)/24)*24 : Y2=Y1+((MY-Y1)/3)*3
  753.             _BOX[X1,Y1,X2,Y2]
  754.          End If 
  755.       End If 
  756.    End If 
  757.    Screen 2
  758.    Centre T$+" - X:"+Str$(X1)+" - Y:"+Str$(Y1)+" / SX:"+Str$(X2-X1)+" - SY:"+Str$(Y2-Y1)+"  "
  759.    If MK=0
  760.       PDR=3 : SX=X2-X1 : SY=Y2-Y1
  761.    End If 
  762.    Return 
  763.    ' Etape 3 : positionnement de la boite 
  764.    GB3:
  765.    X2=MX : Y2=MY : X1=MX-SX : Y1=MY-SY
  766.    If X1<0 : X1=0 : X2=SX : End If 
  767.    If Y1<0 : Y1=0 : Y2=SY : End If 
  768.    _BOX[X1,Y1,X2,Y2]
  769.    Screen 2
  770.    Centre T$+" - X:"+Str$(X1)+" - Y:"+Str$(Y1)+" / SX:"+Str$(SX)+" - SY:"+Str$(SY)+"  "
  771.    If MK=1 : PDR=4 : End If 
  772.    If MK=2
  773.       PDR=1 : Cls : _BOX[0,0,0,0]
  774.       While Mouse Key : Wend 
  775.    End If 
  776.    Return 
  777.    _END:
  778. End Proc[F]
  779. Procedure _BOX[X1,Y1,X2,Y2]
  780.    ' Draw the box 
  781.    S=Screen : Screen 1
  782.    If BXOLD : Put Block 2 : Del Block 2 : BXOLD=0 : End If 
  783.    If X2>X1+1 and Y2>Y1+1
  784.       X=X1 and $FFFFFFF0
  785.       XX=Min(Screen Width,(X2+16) and $FFFFFFF0)
  786.       Gr Writing 0 : Set Pattern 2 : Set Paint 1 : Ink BXINK,BXINK,BXINK
  787.       Get Block 2,X,Y1,XX-X,Y2-Y1+1
  788.       Bar X1,Y1 To X2-1,Y2-1 : BXOLD=-1
  789.    End If 
  790.    Screen S
  791. End Proc
  792. Procedure _MOUSE
  793.    ' Mouse input
  794.    Multi Wait 
  795.    MX=X Screen(X Mouse) : MY=Y Screen(Y Mouse)
  796.    MZ=Mouse Zone : MK=Mouse Key : MS=Mouse Screen
  797. End Proc
  798.  
  799. ' All the interface is here  
  800. Procedure INIT_SCREEN
  801.    Restore DBL
  802.    Repeat 
  803.       Read A$ : DB$=DB$+A$
  804.    Until A$=""
  805.    ESX=660 : ESY=110 : YDI=150
  806.    Screen Open 0,ESX,ESY,8,Hires
  807.    Screen Display 0,,YDI,,
  808.    Curs Off : Flash Off : Cls 0
  809.    GRB_EDITOR_PALETTE
  810.    Paper 0 : Pen 1
  811.    Limit Mouse 128,42 To 447,297
  812.    On Error Goto ERR
  813.    Dialog Open 1,DB$,32,2048
  814.    Pop Proc
  815.    ERR: Print Mid$(DB$,Edialog,80) : Wait Key : Edit 
  816.    ' Definition of quick-run dialog boxes 
  817.    DBL:
  818.    Data "SVar   2,'Ok';"
  819.    Data "SVar   3,'Cancel';"
  820.    Data "SIze   1VA TW 160+,64;"
  821.    Data "BAse   SWidth SX -2/,SHeight SY- 2/;"
  822.    Data "IF     0VA 0\; [SAve   1;]"
  823.    Data "RBox   0,0,SX,SY,0;"
  824.    Data "CTxt   16,8,SX 16-,32,1,1VA;"
  825.    Data "IF     0VA 1=;"
  826.    Data "["
  827.    Data "       BJ 1,16,SY 24-,64,16,3VA; KY 27,0;"
  828.    Data "       BJ 2,SX 80-,SY 24-,64,16,2VA; KY 13,0;"
  829.    Data "       RUn    0,3;"
  830.    Data "]"
  831.    Data "IF     0VA 2=;"
  832.    Data "["
  833.    Data "       BJ 1,SX 80-,SY 24-,64,16,3VA; KY $FF,0;"
  834.    Data "       RUn    0,3;"
  835.    Data "]"
  836.    Data "EXit;"
  837.    ' Definition of the first menu page
  838.    Data "LA 1;"
  839.    Data "SVar   0,'Resource Bank Creator V"+VER$+" - Current bank : ' 0VA !;"
  840.    Data "SVar   1,'Quit';"
  841.    Data "SVar   2,'Create a new bank';"
  842.    Data "SVar   3,'Load a bank';"
  843.    Data "SVar   4,'Save Bank';"
  844.    Data "SVar   5,'Save Bank As';"
  845.    Data "SVar   6,'Edit Graphic Elements';"
  846.    Data "SVar   7,'Edit Text Strings';"
  847.    Data "SVar   8,'Grab Previous Bank';"
  848.    Data "BAse   0,0; SIze SW,SH;"
  849.    Data "BT     1,0,0,48,12,1VA;"
  850.    Data "BI     0,XB,0,SX XB-,12,0VA;"
  851.    Data "RB     0,12,SX,SY,0;"
  852.    Data "BT     3,20,20,210,15,2VA;"
  853.    Data "BT     4,XA,YB,XB XA-,YB YA-,3VA;"
  854.    Data "BT     9,XA,YB,XB XA-,YB YA-,8VA;"
  855.    Data "BT     5,XA,YB,XB XA-,YB YA-,4VA;"
  856.    Data "BT     6,XA,YB,XB XA-,YB YA-,5VA;"
  857.    Data "BT     7,250,20,XB XA-30+,19,6VA;"
  858.    Data "BT     8,XA,YB,XB XA-,YB YA-,7VA;"
  859.    Data "RB     XA,60,490,95,0;"
  860.    Data "PR  XA5+,65,'This program was reviewed by',3;"
  861.    Data "PR  XA,YB,'  M&F Software Corp.� 1994.',3;"
  862.    Data "PR  XA,YB,'     9-11-1994  h17.00',3;"
  863.    Data "SVar   10,'About';"
  864.    Data "BT     10,510,20,100,55,10VA;"
  865.    Data "SVar   10,'Future Ext';"
  866.    Data "BT     11,510,76,100,19,10VA;"
  867.    Data "EXit;"
  868.    ' Definition of the text menu page 
  869.    Data "LA 2;"
  870.    Data "SVar   0,'AMOS Resource Bank Creator - String edition';"
  871.    Data "SVar   1,'Exit';"
  872.    Data "SVar   2,'Clear';"
  873.    Data "SVar   6,'Print';"
  874.    Data "BAse   0,0; SIze SW,SH;"
  875.    Data "BT     1,0,0,48,12,1VA;"
  876.    Data "BI     0,XB,0,SX XB-,12,0VA;"
  877.    Data "RB     0,12,SX,SY,0;"
  878.    Data "LS     3,14,22,SX78-2+,SY6-,%11;"
  879.    Data "BV     6,XB,YA,32,YB YA-,6VA;"
  880.    Data "BV     5,XB,YA,32,YB YA-,2VA;"
  881.    Data "EXit;"
  882.    ' Definition of the pop-up string edition
  883.    Data "LA 3;"
  884.    Data "SVar   2,'String number ' 0VA 1+ # !;"
  885.    Data "SVar   3,'[Esc] Cancel';"
  886.    Data "SVar   4,'[Ret] Replace';"
  887.    Data "SVar   5,'[F1] Insert';"
  888.    Data "SVar   6,'[Del] Delete';"
  889.    Data "BAse   16,8; SIze SW32-,SH16-;SA 1;"
  890.    Data "RBox   0,0,SX,SY,0;"
  891.    Data "RBox   8,4,SX8-,20,1;"
  892.    Data "POut   2VA CX,8,2VA,0,3;"
  893.    Data "RBox   13,30,SX 13-,42,1;"
  894.    Data "EDit   10,16,32,72,250,1VA,0,3;"
  895.    Data "BJ     1,SX 144-,SY 24-,128,16,3VA; KY 27,0;"
  896.    Data "BJ     2,16,SY 24-,128,16,4VA; KY 13,0;"
  897.    Data "BJ     3,XB,YA,XB XA-,YB YA-,5VA; KY $D0,0;"
  898.    Data "BJ     4,XB,YA,XB XA-,YB YA-,6VA; KY $C6,0;"
  899.    Data "RU     0,3;"
  900.    Data "EXit;"
  901.    ' Definition of the graphic element menu 
  902.    Data "LA 4;"
  903.    Data "SVar   0,'AMOS Resource Bank Creator - Graphic Elements Edition';"
  904.    Data "SVar   1,'Exit';"
  905.    Data "SVar   2,'Change Picture';"
  906.    Data "SVar   3,'Grab Element';"
  907.    Data "SVar   4,'Grab Horiz. Line';"
  908.    Data "SVar   5,'Grab A Box';"
  909.    Data "SVar   6,'Del';"
  910.    Data "SVar   7,'Clear';"
  911.    Data "SVar   8,'Grab Vert. Line';"
  912.    Data "BAse   0,0; SIze SW,SH;"
  913.    Data "BT     1,0,0,48,12,1VA;"
  914.    Data "BI     0,XB,0,SX XB-,12,0VA;"
  915.    Data "RB     0,12,SX,SY,0;"
  916.    
  917.    Data "BT     3,12,15,130,SY50-,2VA;"
  918.    Data "BT     4,XB 16+,YA, 160,11,3VA;"
  919.    Data "BT     5,XA,YB,XB XA-,YB YA-,4VA;"
  920.    Data "BT     9,XA,YB,XB XA-,YB YA-,8VA;"
  921.    Data "BT     6,XA,YB,XB XA-,YB YA-,5VA;"
  922.    Data "SVar   10,'Inc X';"
  923.    Data "BT     12,158,YB,80,YB YA-,10VA;"
  924.    Data "SVar   10,'Dec X';"
  925.    Data "BT     13,XB,YA,80,YB YA-,10VA;"
  926.    Data "SVar   10,'Inc Y';"
  927.    Data "BT     14,158,YB,80,YB YA-,10VA;"
  928.    Data "SVar   10,'Dec Y';"
  929.    Data "BT     15,XB,YA,80,YB YA-,10VA;"
  930.    Data "SVar   9,'TRANS';"
  931.    Data "BW     10,158,YB,80,YB YA-,9VA;"
  932.    Data "SVar   9,'SIZE';"
  933.    Data "BW     11,XB,YA,80,YB YA-,9VA;"
  934.    Data "SVar   9,'MOVE BLOCK';"
  935.    Data "BT     16,XB160-,YB,160,YB YA- 2+,9VA;"
  936.    Data "LS     20,XB 16+,15,SX94-,SY6-,%100;"
  937.    Data "BV     7,XB,15,25,YB14-,6VA;"
  938.    Data "BV     8,XB,15,25,YB15-,7VA;"
  939.    'Data "RB     12,76,142,107,1;"
  940.    'Data "PR     17,79,15VA,3;" 
  941.    'Data "PR     17,88,16VA,3;" 
  942.    Data "EXit;"
  943.    ' -------------------------------- 
  944.    ' List Slider: draw a list + a slider, linked together 
  945.    ' LS zone,x,y,x,y,flags
  946.    Data "UI     LS,6; ["
  947.    Data "RB     P2,P3,P2 16+,P5 1+,1;"
  948.    Data "RB     XB,YA,P4,P51+,1;"
  949.    Data "SZone  P1;"
  950.    Data "VSlide P1,P2 3+,P3 2+,9,P5 P3-1-,1P1+VA,7,256,3;[ZChange ZNum 1+,ZPos;SVar 1ZN+,ZPos;]"
  951.    Data "AList  P1 1+,P2 18+,P3 2+,P4 P2- 18- 8/,P5 P3- 8/,P1 VA,1P1+VA,P6,0,3;[]"
  952.    Data "XY     P2,P3,P4,P5;]"
  953.    '----------------------------------------
  954.    ' One button, with vertical text, click only   
  955.    ' BV zone,x,y,sx,sy,text 
  956.    Data "UI     BV,6; ["
  957.    Data "SZone  P6;"
  958.    Data "BU     P1,P2,P3,P4,P5,0,0,1;"
  959.    Data "       [RB 0,0,SX,SY,BP;"
  960.    Data "        VTxt SX 2/ 4- BP+,SY ZVarTLen TH* - 2/ BP+,ZV,3;]"
  961.    Data "       [BR 0;]"
  962.    Data "]"
  963.    '----------------------------------------
  964.    ' One button, with text, click only  
  965.    ' BT zone,x,y,sx,sy,text 
  966.    Data "UI     BT,6; ["
  967.    Data "SZone  P6;"
  968.    Data "BU     P1,P2,P3,P4,P5,0,0,1;"
  969.    Data "       [RB 0,0,SX,SY,BP;"
  970.    Data "        PR ZV CX BP+,SY TH- 2/ BP+1+,ZV,3;]"
  971.    Data "       [BR 0;]"
  972.    Data "]"
  973.    '----------------------------------------
  974.    ' One button, with text, remain activated
  975.    ' BW zone,x,y,sx,sy,text 
  976.    Data "UI     BW,6; ["
  977.    Data "SZone  P6;"
  978.    Data "BU     P1,P2,P3,P4,P5,0,0,1;"
  979.    Data "       [RB 0,0,SX,SY,BP;"
  980.    Data "        PR ZV CX BP+,SY TH- 2/ BP+1+,ZV,3;]"
  981.    Data "       []"
  982.    Data "]"
  983.    '----------------------------------------  
  984.    ' One button, with text to move the screen 
  985.    ' BI zone,x,y,sx,sy,text 
  986.    Data "UI     BI,6; ["
  987.    Data "SZone  P6;"
  988.    Data "BU     P1,P2,P3,P4,P5,0,0,1;"
  989.    Data "       [RB 0,0,SX,SY,BP;"
  990.    Data "        PR ZV CX BP+,SY TH- 2/ BP+,ZV,3;]"
  991.    Data "       [SMove;BR 0;]"
  992.    Data "]"
  993.    '----------------------------------------
  994.    ' One button, with text, click only, QUIT!   
  995.    ' BJ zone,x,y,sx,sy,text 
  996.    Data "UI     BJ,6; ["
  997.    Data "SZone  P6;"
  998.    Data "BU     P1,P2,P3,P4,P5,0,0,1;"
  999.    Data "       [RB 0,0,SX,SY,BP;"
  1000.    Data "        PO ZV CX BP+,SY TH- 2/ BP+,ZV,0,3;]"
  1001.    Data "       [BR 0;BQuit;]"
  1002.    Data "]"
  1003.    '----------------------------------------
  1004.    ' Text centered in one RB
  1005.    ' CT x1,y1,x2,y2,act,text
  1006.    Data "UI     CT,6; ["
  1007.    Data "RB     P1,P2,P3,P4,P5;"
  1008.    Data "PRint  P3 P1- P6TW- 2/ P1+,P4 P2- TH- 2/ P2+,P6,3;"
  1009.    Data "XY     P1,P2,P3,P4;]"
  1010.    '----------------------------------------
  1011.    ' Ronnies Simpson graphic box definition 
  1012.    ' RB x1,y1,x2,y2,activated 
  1013.    Data "UI     RB,5; [SWrite 1; SPattern 0,0;"
  1014.    Data "IF     P5 0=;["
  1015.    Data "INk    0,0,0; GSquare P1,P2,P3 1-,P4 1-;"
  1016.    Data "INk    6,6,6; GBox P1 1+,P2 1+,P3 2-,P4 2-; "
  1017.    Data "INk    5,5,5; GLine P1 2+,P4 2-,P1 2+,P2 1+;"
  1018.    Data "              GLine P1 1+,P4 2-,P1 1+,P2 1+;"
  1019.    Data "              GLine P1 1+,P2 1+,P3 2-,P2 1+;"
  1020.    Data "INk    2,2,2; GLine P1 2+,P4 2-,P3 2-,P4 2-;"
  1021.    Data "              GLine P3 3-,P2 2+,P3 3-,P4 2-;"
  1022.    Data "              GLine P3 2-,P2 1+,P3 2-,P4 2-;"
  1023.    Data "INk    3,3,3; GLine P1 3+,P2 2+,P1 4+,P2 2+;]"
  1024.    Data "IF     P5 0\;["
  1025.    Data "INk    0,0,0; GSquare P1,P2,P3 1-,P4 1-;"
  1026.    Data "INk    2,2,2; GBox P1 1+,P2 1+,P3 2-,P4 2-; "
  1027.    Data "INk    1,1,1; GLine P1 2+,P4 2-,P1 2+,P2 1+;"
  1028.    Data "              GLine P1 1+,P4 2-,P1 1+,P2 1+;"
  1029.    Data "              GLine P1 1+,P2 1+,P3 2-,P2 1+;"
  1030.    Data "INk    5,5,5; GLine P1 2+,P4 2-,P3 2-,P4 2-;"
  1031.    Data "              GLine P3 3-,P2 2+,P3 3-,P4 2-;"
  1032.    Data "              GLine P3 2-,P2 1+,P3 2-,P4 2-;]"
  1033.    Data "SWrite 0; XY P1,P2,P3,P4;]"
  1034.    Data ""
  1035. End Proc
  1036.  
  1037. Procedure GRB_EDITOR_PALETTE
  1038.    ADAT=Leek(Dreg(3))
  1039.    If ADAT=0
  1040.       Palette 0,$6F,$77,$EEE,$F00,$DD,$AA,$FF3
  1041.    Else 
  1042.       For C=0 To 7
  1043.          Colour C,Deek(ADAT+28+C*2)
  1044.       Next 
  1045.       Colour 1,(Colour(2) and $EEE)/2
  1046.    End If 
  1047. End Proc
  1048. Procedure LOWMEM
  1049.    
  1050.    Screen Open 0,640,8,2,Hires : Curs Off 
  1051.    Colour 1,$FFF
  1052.    Centre "Memory too low. Press any key to abort."
  1053.    Wait Key 
  1054.    Edit 
  1055.    
  1056. End Proc
  1057. Procedure MN_PRINT
  1058.    
  1059.    Dialog Freeze 
  1060.    
  1061.    For MS=STMX To 0 Step -1
  1062.       Exit If ST$(MS)-" "<>""
  1063.    Next 
  1064.    
  1065.    If MS>=0
  1066.       
  1067.       X=Free
  1068.       
  1069.       D=Dialog Box(DB$,1,"Print all strings: please check printer and click on [OK]") : If D<>2 : Pop Proc : End If 
  1070.       
  1071.       Do 
  1072.          Trap Printer Open 
  1073.          Exit If Errtrap=0
  1074.          R=Dialog Box(DB$,1,"Printer not ready. Click on [Ok] to try again.")
  1075.          If R<>2 : Pop Proc : End If 
  1076.       Loop 
  1077.       
  1078.       D=Dialog Box(DB$,0,"Printing resource strings.")
  1079.       
  1080.       For S=0 To MS
  1081.          
  1082.          If Printer Online=0
  1083.             Repeat 
  1084.                R=Dialog Box(DB$,1,"Printer not ready. Click on [Ok] to try again.")
  1085.                Exit If R<>2,2
  1086.             Until Printer Online
  1087.          End If 
  1088.          
  1089.          A$=Mid$(Str$(S),2)+"-"+ST$(S)
  1090.          Trap Printer Send A$+Chr$(27)+"E"
  1091.          Repeat : Exit If Inkey$<>"",2 : Multi Wait : Until Printer Check
  1092.          
  1093.       Next 
  1094.       
  1095.       Repeat : Exit If Inkey$<>"" : Until Printer Check
  1096.       Trap Printer Close 
  1097.       
  1098.    End If 
  1099.    
  1100.    Dialog Unfreeze 
  1101.    Pop Proc
  1102.    
  1103. End Proc
  1104. Procedure MN_MOVE
  1105.    Dialog Freeze 
  1106.    Screen Hide 0
  1107.    T=1 : X2=PUSX(CPU) : Y2=PUSY(CPU)
  1108.    SX=X2 : SY=Y2
  1109.    XF1=PUX(CPU) : YF1=PUY(CPU)
  1110.    ' Prepare screen 1 
  1111.    Screen 1 : Clip 
  1112.    Gr Writing 2 : PDR=1 : O=0 : OMX=-1
  1113.    Set Pattern 0 : Set Paint 0
  1114.    _BOX[0,0,0,0]
  1115.    ' Open small info screen 
  1116.    Screen Open 2,640,8,2,Hires
  1117.    Curs Off : Palette $55A,$FFF : Screen Display 2,,320,,
  1118.    T$="     Moving an element"
  1119.    ' Main loop  
  1120.    Repeat 
  1121.       Screen 1 : _MOUSE
  1122.       MX=(MX+3) and $FFFFFFF8
  1123.       If Inkey$=" " : Add BXINK,1,0 To Screen Colour : End If 
  1124.       ' Change the position of the info screen 
  1125.       If MY>150
  1126.          Screen Display 2,,45,,
  1127.       Else 
  1128.          Screen Display 2,,245,,
  1129.       End If 
  1130.       ' Call the proper display routine  
  1131.       If MS=1
  1132.          If MX<>OMX or MY<>OMY or MK<>OMK
  1133.             On PDR Gosub GB1
  1134.             OMX=MX : OMY=MY : OMK=MK
  1135.          End If 
  1136.       End If 
  1137.       ' Wait for the end 
  1138.    Until PDR=0 or PDR=4
  1139.    ' Something to erase?
  1140.    _BOX[0,0,0,0]
  1141.    ' Close the info screen  
  1142.    Screen Close 2 : F=0
  1143.    If PDR=4
  1144.       BXX=X1 : BXY=Y1 : BXSX=SX : BXSY=SY
  1145.       F=-1
  1146.       Goto _END
  1147.    End If 
  1148.    Goto _END1
  1149.    ' Step 1 : set the beginning of the box
  1150.    GB1:
  1151.    X1=MX : Y1=MY : X2=SX : Y2=SY
  1152.    If MX<SX : MX=SX : X Mouse=X Hard(MX) : End If 
  1153.    If MY<SY : MY=SY : Y Mouse=Y Hard(MY) : End If 
  1154.    Screen 2 : Centre T$+" - X:"+Str$(X1)+" - Y:"+Str$(Y1)+" - W:"+Str$(SX)+" - H:"+Str$(SY)+"   "
  1155.    X2=MX : Y2=MY : X1=MX-SX : Y1=MY-SY
  1156.    _BOX[X1,Y1,X2,Y2]
  1157.    If MK=1 : PDR=4 : End If 
  1158.    If MK=2 : PDR=0 : PUX(CPU)=XF1 : PUY(CPU)=YF1 : End If 
  1159.    Return 
  1160.    _END:
  1161.    PUX(CPU)=X1 : PUY(CPU)=Y1
  1162.    _END1:
  1163.    Screen Show 0 : Screen To Front 0 : Screen 0
  1164.    Dialog Unfreeze 
  1165. End Proc[F]
  1166. Procedure MN_INCX
  1167.    Screen 1 : SW=Screen Width
  1168.    If PUN(CPU)=1 : XVA=8 : YVA=1 : End If 
  1169.    If PUN(CPU)=3 : XVA=24 : YVA=1 : End If 
  1170.    If PUN(CPU)=-3 : XVA=8 : YVA=3 : End If 
  1171.    If PUN(CPU)=9 : XVA=24 : YVA=3 : End If 
  1172.    If MOVE=2
  1173.       If PUX(CPU)+PUSX(CPU)<SW-XVA
  1174.          Add PUSX(CPU),XVA
  1175.       End If 
  1176.    End If 
  1177.    If MOVE=1
  1178.       If PUX(CPU)<SW
  1179.          Add PUX(CPU),8
  1180.       End If 
  1181.    End If 
  1182.    PU_ARRAY1
  1183.    Dialog Update 1,SA+1,,CPU,PULAST+2
  1184. End Proc
  1185. Procedure MN_DECX
  1186.    If PUN(CPU)=1 : XVA=8 : YVA=1 : End If 
  1187.    If PUN(CPU)=3 : XVA=24 : YVA=1 : End If 
  1188.    If PUN(CPU)=-3 : XVA=8 : YVA=3 : End If 
  1189.    If PUN(CPU)=9 : XVA=24 : YVA=3 : End If 
  1190.    If MOVE=2
  1191.       If PUSX(CPU)>XVA+1
  1192.          Add PUSX(CPU),-XVA
  1193.       End If 
  1194.    End If 
  1195.    If MOVE=1
  1196.       If PUX(CPU)>7
  1197.          Add PUX(CPU),-8
  1198.       End If 
  1199.    End If 
  1200.    PU_ARRAY1
  1201.    Dialog Update 1,SA+1,,CPU,PULAST+2
  1202. End Proc
  1203. Procedure MN_INCY
  1204.    Screen 1 : SH=Screen Height
  1205.    If PUN(CPU)=1 : XVA=8 : YVA=1 : End If 
  1206.    If PUN(CPU)=3 : XVA=24 : YVA=1 : End If 
  1207.    If PUN(CPU)=-3 : XVA=8 : YVA=3 : End If 
  1208.    If PUN(CPU)=9 : XVA=24 : YVA=3 : End If 
  1209.    If MOVE=2
  1210.       If PUY(CPU)+PUSY(CPU)<SH-1
  1211.          Add PUSY(CPU),YVA
  1212.          PU_ARRAY1
  1213.          Dialog Update 1,SA+1,,CPU,PULAST+2
  1214.       End If 
  1215.    End If 
  1216.    If MOVE=1
  1217.       If PUY(CPU)<SH
  1218.          Add PUY(CPU),1
  1219.       End If 
  1220.    End If 
  1221. End Proc
  1222. Procedure MN_DECY
  1223.    If PUN(CPU)=1 : XVA=8 : YVA=1 : End If 
  1224.    If PUN(CPU)=3 : XVA=24 : YVA=1 : End If 
  1225.    If PUN(CPU)=-3 : XVA=8 : YVA=3 : End If 
  1226.    If PUN(CPU)=9 : XVA=24 : YVA=3 : End If 
  1227.    If MOVE=2
  1228.       If PUSY(CPU)>YVA+1
  1229.          Add PUSY(CPU),-YVA
  1230.       End If 
  1231.    End If 
  1232.    If MOVE=1
  1233.       If PUY(CPU)>0
  1234.          Add PUY(CPU),-1
  1235.       End If 
  1236.    End If 
  1237.    PU_ARRAY1
  1238.    Dialog Update 1,SA+1,,CPU,PULAST+2
  1239. End Proc
  1240. Procedure PU_ARRAY1
  1241.    'aggiorna la lista velocemente 
  1242.    PUPICS=CPU+1
  1243.    P=CPU
  1244.    If PUN(CPU)
  1245.       A$=Str$(PUPICS) : PU$(P)=A$+Space$(4-Len(A$))
  1246.       If PUN(P)=1 : A$=" - Element:" : End If 
  1247.       If PUN(P)=3 : A$=" - H. Line:" : End If 
  1248.       If PUN(P)=-3 : A$=" - V. Line:" : End If 
  1249.       If PUN(P)=9 : A$=" - Box    :" : End If 
  1250.       PU$(P)=PU$(P)+A$+Str$(PUSX(P))+" x"+Str$(PUSY(P))
  1251.       Add PUPICS,Abs(PUN(P))
  1252.    End If 
  1253.    Screen 0
  1254. End Proc
  1255. Procedure MN_MOVE1
  1256. MOVE=1
  1257. Dialog Update 1,11,0
  1258. End Proc
  1259. Procedure MN_MOVE2
  1260. MOVE=2
  1261. Dialog Update 1,10,0
  1262. End Proc
  1263. Procedure _ERROR
  1264.    D=Dialog Box(DB$,2,"It is not an IFF picture!")
  1265. End Proc
  1266. ' Not yet implemented  
  1267. Procedure _INFO
  1268.    SH$=Str$(SH1) : SW$=Str$(SW1)
  1269.    L=Len(SW$)+Len(SH$)
  1270.    L$=Space$((13-L)/2)
  1271.    S$="W"+SW$+L$+"H"+SH$+" "
  1272.    Vdialog$(1,15)=S$
  1273.    If SW2=320 Then S$="Lowres" Else S$="Hires"
  1274.    If SH2=256 Then S1$="No-Lace" Else S1$="Laced"
  1275.    S$=" "+S$+" "+S1$
  1276.    Vdialog$(1,16)=S$
  1277. End Proc